package com.ruoyi.internship.mapper;

import java.util.List;
import com.ruoyi.internship.domain.BolePosition;
import com.ruoyi.internship.domain.BolePostionApplication;
import com.ruoyi.internship.dto.PositionDetailDTO;
import com.ruoyi.internship.vo.PositionList;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.data.domain.Page;

/**
 * 职位信息Mapper接口
 * 
 * @author ruoyi
 * @date 2025-03-29
 */
public interface BolePositionMapper 
{
    //查询职位详细信息
    @Select("SELECT " +
            "po.position_id AS positionId, " +
            "po.company_id AS companyId, " +
            "po.title AS title, " +
            "po.type AS type, " +
            "po.location AS location, " +
            "po.duration AS duration, " +
            "po.salary AS salary, " +
            "po.duties AS duties, " +
            "po.requirements AS requirements, " +
            "po.conversion_rate AS conversionRate, " +
            "po.promotion_path AS promotionPath, " +
            "po.create_time AS createTime, " +
            "po.update_time AS updateTime, " +
            "po.del_flag AS delFlag, " +
            "bc.company_name AS companyName, " +
            "bc.logo_url AS logoUrl, " +
            "bc.industry AS industry, " +
            "bc.employees AS employees, " +
            "bc.revenue AS revenue " +
            "FROM bole_position po " +
            "LEFT JOIN bole_company bc ON po.company_id = bc.company_id " +
            "WHERE po.position_id = #{positionId} " +
            "AND po.company_id = #{companyId}")
    PositionDetailDTO selectPositionDetail(@Param("positionId") Long positionId,
                                           @Param("companyId") Long companyId);
//    查询职位和公司信息
@Select("SELECT po.position_id AS positionId, po.company_id AS companyId, " +
        "po.title AS title, po.type AS type, po.location AS location, " +
        "po.salary AS salary, bc.company_name AS companyName " +
        "FROM bole_position po " +
        "LEFT JOIN bole_company bc ON po.company_id = bc.company_id " +
        "WHERE po.title LIKE CONCAT('%', #{keyword}, '%') OR bc.company_name LIKE CONCAT('%', #{keyword}, '%')")
    List<PositionList> selectPositionList(@Param("keyword") String keyword);
    /**
     * 查询职位信息
     * 
     * @param positionId 职位信息主键
     * @return 职位信息
     */
    public BolePosition selectBolePositionByPositionId(String positionId);

    /**
     * 查询职位信息列表
     * 
     * @param bolePosition 职位信息
     * @return 职位信息集合
     */
    public List<BolePosition> selectBolePositionList(BolePosition bolePosition);

    /**
     * 新增职位信息
     * 
     * @param bolePosition 职位信息
     * @return 结果
     */
    public int insertBolePosition(BolePosition bolePosition);

    /**
     * 修改职位信息
     * 
     * @param bolePosition 职位信息
     * @return 结果
     */
    public int updateBolePosition(BolePosition bolePosition);

    /**
     * 删除职位信息
     * 
     * @param positionId 职位信息主键
     * @return 结果
     */
    public int deleteBolePositionByPositionId(String positionId);

    /**
     * 批量删除职位信息
     * 
     * @param positionIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBolePositionByPositionIds(String[] positionIds);

    /**
     * 批量删除职位申请记录
     * 
     * @param positionIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteBolePostionApplicationByPositionIds(String[] positionIds);
    
    /**
     * 批量新增职位申请记录
     * 
     * @param bolePostionApplicationList 职位申请记录列表
     * @return 结果
     */
    public int batchBolePostionApplication(List<BolePostionApplication> bolePostionApplicationList);
    

    /**
     * 通过职位信息主键删除职位申请记录信息
     * 
     * @param positionId 职位信息ID
     * @return 结果
     */
    public int deleteBolePostionApplicationByPositionId(String positionId);
}
